package schema

import (
	"entgo.io/ent"
	"entgo.io/ent/dialect"
	"entgo.io/ent/schema/field"
	"entgo.io/ent/schema/mixin"
	"time"
)

type BankStatement struct {
	ent.Schema
}

// Mixin of the BankStatement
func (BankStatement) Mixin() []ent.Mixin {
	return []ent.Mixin{
		OperationPerson{},
		mixin.Time{},
	}
}

// Fields of the BankStatement.
func (BankStatement) Fields() []ent.Field {
	return []ent.Field{
		field.Float("amount").SchemaType(map[string]string{
			dialect.MySQL: "decimal(10,2)",
		}).Default(0).Comment("金额"),

		field.Time("statement_time").SchemaType(map[string]string{
			dialect.MySQL: "datetime",
		}).Default(time.Now()).Comment("流水时间"),

		field.String("note").SchemaType(map[string]string{
			dialect.MySQL: "varchar(255)",
		}).Default("").Comment("注释"),
	}
}
